-
Notifications
You must be signed in to change notification settings - Fork 51
feat: instructions sysvar #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think this mockup looks good to me. Then the new module is just the logic from #100?
0c3cb35
to
42a44b6
Compare
yes, i forced pushed since i forgot the file... Since this is a sysvar though should this happen automagically inside mollusk setup? Rather than being an account people must add |
Yep I think so! Typically I try to avoid overwriting user-provided accounts, even if it's a special account like this one. So we should make sure we first check if the account was provided already, and if it was not, then do this setup logic. That being said, the harness does one allocation for the provided accounts slice when it creates a list of "transaction accounts" from the account compilation step. Lines 683 to 687 in 1cfdd64
So I'm thinking maybe we can push it into the accounts list here? This way it's in the transaction accounts list before we even create the I'm open to whether or not we should include the auto-populated Instructions Sysvar account in the resulting accounts list. I can go either way: return it or cut it out. |
It can't be that deep because the |
Ah yes, you're right... How about this? I set up a PR that should decouple things enough for you to stick this step right before the account compilation step and use a chained iterator to feed Let me know if this works for you! |
Inspired by #100, roughly how i made it work in my fork
Note, there is the need to be able to set
top_level_instruction_index
onTransactionContext
, otherwise the instruction in a batch are getting the wrong index, this is caused by the mollusk hack of not offering close to the original VM running and entire "transaction".TransactionContext::push
will set the instructions sysvar current index totop_level_instruction_index
https://github.com/anza-xyz/agave/blob/85d8b5859ebe462236fd22acdeaa556d82ad4f54/transaction-context/src/lib.rs#L446-L449